/**
 * Franknew's new java file.
 *
 * created on 2008-6-5
 * Copyright 2008 EGT.
 */

// Defines application wide constants
package constants;
import java.awt.Dimension;
import java.awt.Font;
import java.io.File;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.JOptionPane;

import com.maplesoft.openmaple.Engine;
import automatica.TypeIndex;
import automatica.autoprove.CallBacks;





public class GTextbookConstants { 
	

	public static void initialize(){
		logicalWords.add("and");
		logicalWords.add("or");
		logicalWords.add("not");
		algebraicWords.add("plus");
		algebraicWords.add("minus");
		algebraicWords.add("times");
		algebraicWords.add("divide");
		algebraicWords.add("sin");
		algebraicWords.add("cos");
		algebraicWords.add("tg");
		setWords.add("choosediff");
		setWords.add("setdiff");
		
		statementWords.add("assume");
		statementWords.add("show");
		statementWords.add("hypothesis");
		statementWords.add("objective");
		statementWords.add("configuration");
		statementWords.add("declare");
		statementWords.add("Declare");
		statementWords.add("give");
		
		constantWords.add("pi");
		
		
		
		conceptWithOneAttribute.add("midpoint");
		
		operation4Set.add("choosediff");
		operation4Set.add("setdiff");

		introductionTitleWords.add("preface");
		introductionTitleWords.add("Preface");
		
		reserveWords.addAll(logicalWords);
		reserveWords.addAll(algebraicWords);
		reserveWords.addAll(setWords);
		reserveWords.addAll(statementWords);
		reserveWords.addAll(constantWords);
		
		if(!new File(EXTERNAL_FILE_DIRECTORY).exists()) {
	        if(!new File(EXTERNAL_FILE_DIRECTORY).mkdirs()) {
	        	JOptionPane.showMessageDialog(null,
	                                        "Error creating default directory",
	                                        "Directory Creation Error",
	                                        JOptionPane.ERROR_MESSAGE);
	        	
	        	return;
	        }
	      }
		
		if(!new File(TEMP_PATH).exists()) {
	        if(!new File(TEMP_PATH).mkdirs()) {
	        	JOptionPane.showMessageDialog(null,
	                                        "Error creating default directory",
	                                        "Directory Creation Error",
	                                        JOptionPane.ERROR_MESSAGE);
	        	
	        	return;
	        }
	      }
		
		if(!new File(TEMP_NLP_PATH).exists()) {
	        if(!new File(TEMP_NLP_PATH).mkdirs()) {
	        	JOptionPane.showMessageDialog(null,
	                                        "Error creating default directory",
	                                        "Directory Creation Error",
	                                        JOptionPane.ERROR_MESSAGE);
	        	
	        	return;
	        }
	      }
		
		if(!new File(TEMP_NLP_FORMAL_PATH).exists()) {
	        if(!new File(TEMP_NLP_FORMAL_PATH).mkdirs()) {
	        	JOptionPane.showMessageDialog(null,
	                                        "Error creating default directory",
	                                        "Directory Creation Error",
	                                        JOptionPane.ERROR_MESSAGE);
	        	
	        	return;
	        }
	      }

	}

	
	
	
	public static String User_Name = null;
	public static TypeIndex index4prove = null;
	public static TypeIndex index4draw = null;
	

	public static String[] getNewLabelPallet() {
		//"x", "y", "z" are key words in GeoGebra
		String[] buf ={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P",
				"Q","R","S","T","U","V","W"};
		return buf;
	}
	
	//set the label for newly generated function label when generating drawing instructions
	public static String functionLabel = "function";
	public static String predicateLabel = "predicate";
	public static String variableLabel = "var";
	public static String[] pointLabels = {"point", "center", "pointon", "intersection", "foot"};

	//global variable for prove
	public static Engine engine;
	public static CallBacks callback;



	//reserve key words
	public static ArrayList<String> logicalWords = new ArrayList<String>();
	public static ArrayList<String> algebraicWords = new ArrayList<String>();
	public static ArrayList<String> setWords = new ArrayList<String>();
	public static ArrayList<String> statementWords = new ArrayList<String>();
	public static ArrayList<String> constantWords = new ArrayList<String>();
	public static ArrayList<String> reserveWords = new ArrayList<String>();
	public static ArrayList<String> introductionTitleWords = new ArrayList<String>();
	public static ArrayList<String> remarkTitleWords = new ArrayList<String>();
	//the hack: collinear({A;B;C}) --> collinear(A,B,C)
	public static ArrayList<String> conceptWithOneAttribute = new ArrayList<String>();
	{};
	public static ArrayList<String> operation4Set = new ArrayList<String>();
	
	//the types of differnet statements
	public static int String_Formal_Definition = 3;
	public static int String_Formal_Assertion = 4;
	public static int String_Formal_Definition_TargetConcept = 0;
	public static int String_Formal_Definition_ReturnObject = 1;
	public static int String_Formal_Definition_ReturnConstraint = 2;

	public static int Polish_Type = 0;
	public static int Natural_Type = 1;
	public static int Written_Type = Polish_Type;
	
	
	
	//declare the items of the list
	  public static Vector<String> Relation_Type = new Vector<String>(1,1);
	  public static Vector<String> Formal_Logic_Relation = new Vector<String>(1,1);
	  public static Vector<String> Formal_Problem_Relation = new Vector<String>(1,1);
	  public static Vector<String> Primite_Type = new Vector<String>(1,1);
	  public static Vector<String> User_List = new Vector<String>(1,1);
	  public static Vector<String[]> User_Info_List = new Vector<String[]>(1,1);
	  public static Vector<String[]> Style_Format = new Vector<String[]>(1,1);
	  public static Vector<String[]> Symbol_Format = new Vector<String[]>(1,1);
	  
	  
	  
	  
	  
	 // Constants used in creating a sketch in XML
	  public final static String QUOTE_ENTITY = "&quot;";
	  public final static char QUOTE = '\"';
	  public final static char NEWLINE = '\n';
	  public final static char TAG_START = '<';
	  public final static char TAG_END = '>';
	  public final static String EMPTY_TAG_END = "/>";
	  public final static String END_TAG_START = "</";
	  public  static String Indent = "    ";
	
	
	  // the constants for presentation
	  
	  public final static int MathDox = 0;
	  public final static int EGT = 1;
	  public final static int OMDoc = 2;
	public static int presentationStyle;
	
	// the options of the language
  public static int Chinese = 1;
  public static int English = 0;
  public static Language language = new Language(English);
  
  public static class Language{
	  public Language(int language){
		  if(language == English){
			  this.string = "english";
			  this.num = language;
		  }
		  if(language == Chinese){
			  this.string = "����";
			  this.num = language;
		  }
	  }
	  
	  String string;
	  public String getString() {
		return string;
	}
	public void setString(String string) {
		this.string = string;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}

	int num;
  }
  
  
  
  //set different types of objects, i.e., tree node
  public final static int Category = 100;
  public final static int knowledgeObject = 101;
  public final static int Assertion = 102;
  public final static int Problem = 103;
  public final static int Note = 104;
  
  public final static int Definition = 105;
  public final static int Axiom     = 106;
  public final static int Proposition = 107;
  public final static int Theorem   = 108;
  public final static int Lemma = 109;
  public final static int Corollary = 110;
  public final static int Conjecture = 111;
  public final static int Exercise = 112;
  public final static int Example = 113;
  public final static int Proof = 114;
  public final static int Solution = 115;
  public final static int Algorithm = 116;
  public final static int Introduction = 117;
  public final static int Remark = 118;
  public final static int Hint = 119;
  public final static int Type = 120;


  //set different types of operations on the node
  public final static int Query = 98;
  public final static int RemoveNode = 97;
  public final static int RemoveKB = 96;
  public final static int View = 95;
  public final static int Modify = 94;
  public final static int GEOTHERProve = 93;
  public final static int GeoGebraDraw = 92;
  public final static int GeoDraw = 91;
  
  
  //set different operations on textbook interface or database interface
  public final static int Database = 200;
  public final static int Textbook = 201;
  
  // Dimension -- look of the components in user interface
  public final static Dimension Basic_Text_Field_Dimension = new Dimension(200,30);
  public final static Dimension Advanced_Text_Area_Dimension = new Dimension(668,100);
  public final static Dimension Proof_Area_Dimension = new Dimension(600,300);
  public final static Dimension Intro_Area_Dimension = new Dimension(600,600);
  public final static Dimension Category_Text_Area_Dimension = new Dimension(400,80);
  public final static Dimension Relation_Text_Area_Dimension = new Dimension(400,50);
  public final static Dimension ComboBox_Dimension = new Dimension(265,30);
  public final static int Text_Field_Columns = 20;
  public final static Dimension File_Choose_ComboBox_Dimension = new Dimension(400,25);
  public final static Dimension Button_Dimension = new Dimension(100,25);
  public final static Dimension Label_Chinese_Dimension = new Dimension(80,30);
  public final static Dimension Label_English_Dimension = new Dimension(70,35);
  public final static Dimension Query_Text_Area_Dimension = new Dimension(700,80);
  public final static Dimension Figure_Dimension = new Dimension(100,100);
  public final static Dimension Figure_Name_Dimension = new Dimension(50,20);
  public final static Dimension Figure_Area_Dimension = new Dimension(600,150);
  public final static Dimension Segment_Browser_Dimension = new Dimension(500,150);
  
  // Font
  /**
   * software menu
   * dndTree
   * dialog -- label
   * dialog -- button
   * dialog -- input
   * prefuse -- tree
   * 
   */
  //public static Font Label_English_Font = new Font("Bookman Old Style", Font.BOLD, 14);
  public static Font Label_English_Font = new Font("Dialog", Font.BOLD, 14);
  public static Font Label_Chinese_Font = new Font("Dialog", Font.BOLD, 14);
  public static Font Input_English_Font = new Font("Dialog", Font.PLAIN,15);
  public static Font Input_Chinese_Font = new Font("Dialog", Font.PLAIN,13);
  public static Font Button_Chinese_Font = new Font("Dialog", Font.PLAIN,15);
  public static Font Button_English_Font = new Font("Dialog", Font.PLAIN,15);
  public static Font Textbook_Engligh_Font = new Font("Dialog", Font.BOLD,16);
  public static Font Textbook_Chinese_Font = new Font("Dialog", Font.BOLD,15);
  public static Font Query_Engligh_Font = new Font("Dialog", Font.BOLD,13);
  public static Font Query_Chinese_Font = new Font("Dialog", Font.BOLD,12);
  public static Font Relation_Check_Font = new Font("Dialog", Font.PLAIN,14);
  public  static Font Knowledge_Font = new Font("Dialog", Font.PLAIN,15);
  public  static Font Knowledge_Label_Font = new Font("Times New Roman",Font.BOLD,21);
  public  static Font Knowledge_Cursor_Font = new Font("Dialog", Font.PLAIN,15);
  public  static Font Status_English_Font = new Font ("Dialog", Font.BOLD,15);
  public  static Font Status_Chinese_Font = new Font ("Dialog", Font.BOLD,15);
  
  
  
  
  //set the fonts of the branch, Head_Font(0) is the font of title
  //public static Vector<Font> Head_Font = new Vector<Font>(5,2);
  //public static Font H2 = new Font ("Dialog", Font.PLAIN,25);
   

  public static TypeIndex index = null;
  
  //file path 
  //public final static File DEFAULT_ROOT = new File(");
  //public final static File DEFAULT_DIRECTORY = new File("");
  //public static File SETUP_DIRECTORY = new File("/D:/GTextbook");
 // public static File TEXTBOOK_DIRECTORY = SETUP_DIRECTORY;
  public static String rootDir = System.getProperty("user.dir");
  public static String EXTERNAL_FILE_DIRECTORY= rootDir + "/geometryTransformation";
  public static String TEMP_PATH = EXTERNAL_FILE_DIRECTORY + "/temp";
  public static String XSL_PATH = EXTERNAL_FILE_DIRECTORY + "/xsl";
  public static String JAVASCRIPT_PATH = EXTERNAL_FILE_DIRECTORY + "/javascript";
  public static String GEOGEBRA_PATH = EXTERNAL_FILE_DIRECTORY + "/geogebra";
  public static String IMAGE_PATH = EXTERNAL_FILE_DIRECTORY + "/image";
  public static String TEMP_NLP_PATH = TEMP_PATH + "/nlp";
  public static String TEMP_NLP_FORMAL_PATH = TEMP_NLP_PATH + "/formalization";
		  
  public static String PROBLEM_PATH = TEMP_PATH + "/problem.xml";
  public static String Transformation_Result = TEMP_PATH + "/transformationResult.xml";
  public static String Transformation_Presentation_Result = TEMP_PATH + "/transformationPresentationResult.xml";
  public static String SCRIPT_XML = TEMP_PATH + "/script.xml";
  public static String script4draw = TEMP_PATH + "/script4draw.txt";
  public static String Draw_Mapping_Result = TEMP_PATH + "/result4draw.txt";
  public static String script4prove = TEMP_PATH + "/script4prove.txt";
  public static String Prove_Mapping_Result = TEMP_PATH + "/result4prove.txt";
  public static String Presentation_Temp = TEMP_PATH + "/presentationTemp.xml";
  public static String Script_Presentation_Temp = TEMP_PATH + "/scriptPresentationTemp.xml";
  public static String Problem_Presentation_Temp = TEMP_PATH + "/problemPresentationTemp.xml";
  public static String Proof_Result = TEMP_PATH + "/proof.html";
  public static String Draw_Result = TEMP_PATH + "/draw.html";
  public static String xml2string4draw = XSL_PATH + "/transformation/xml2string4draw.xsl";
  public static String xml2string4prove = XSL_PATH + "/transformation/xml2string4prove.xsl";
  public static String gdl2english = XSL_PATH + "/translation/gdl2english.xsl";
  
  public static String English_Problem_Result = TEMP_PATH + "/englishProblem.xml";
  
  public static String Presentation_Macro_XSL= XSL_PATH + "/presentation/macro.xsl";
  
  public static int figureByteSize = 500000;
  public static int ggbfigureByteSize = 500000;
  
  //access to the SQLserver 2005
  /*
  public static String Host = "124.207.188.101:1433";
  public static String DatabaseName = "GBase";
  public static String DatabaseUserName = "geotext";
  public static String DatabasePassWord = "gbase@geotext@sklsde";
  
  
 
  public static String Host = "124.207.188.101:1433";
  public static String DatabaseName = "GBase";
  public static String DatabaseUserName = "sa";
  public static String DatabasePassWord = "G606@nlsde.buaa.edu.cn";
  
  public static String DriverURL = "jdbc:sqlserver://"+constants.GTextbookConstants.Host+";DatabaseName="
  public static String DriverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";

  */
  


	
  
  public final static int pointSizeMin = 10;      // Minimum font point size
  public final static int pointSizeMax = 40;     // Maximum font point size
  public final static int pointSizeStep = 1;
  
  
  
public static Font getLabel_English_Font() {
	return Label_English_Font;
}

public static void setLabel_English_Font(Font label_English_Font) {
	Label_English_Font = label_English_Font;
}

public static Font getLabel_Chinese_Font() {
	return Label_Chinese_Font;
}

public static void setLabel_Chinese_Font(Font label_Chinese_Font) {
	Label_Chinese_Font = label_Chinese_Font;
}

public static Font getInput_English_Font() {
	return Input_English_Font;
}

public static void setInput_English_Font(Font input_English_Font) {
	Input_English_Font = input_English_Font;
}

public static Font getInput_Chinese_Font() {
	return Input_Chinese_Font;
}

public static void setInput_Chinese_Font(Font input_Chinese_Font) {
	Input_Chinese_Font = input_Chinese_Font;
}

public static Font getButton_Chinese_Font() {
	return Button_Chinese_Font;
}

public static void setButton_Chinese_Font(Font button_Chinese_Font) {
	Button_Chinese_Font = button_Chinese_Font;
}

public static Font getButton_English_Font() {
	return Button_English_Font;
}

public static void setButton_English_Font(Font button_English_Font) {
	Button_English_Font = button_English_Font;
}

public static Font getTextbook_Engligh_Font() {
	return Textbook_Engligh_Font;
}

public static void setTextbook_Engligh_Font(Font textbook_Engligh_Font) {
	Textbook_Engligh_Font = textbook_Engligh_Font;
}

public static Font getTextbook_Chinese_Font() {
	return Textbook_Chinese_Font;
}

public static void setTextbook_Chinese_Font(Font textbook_Chinese_Font) {
	Textbook_Chinese_Font = textbook_Chinese_Font;
}

public static Font getRelation_Check_Font() {
	return Relation_Check_Font;
}

public static void setRelation_Check_Font(Font relation_Check_Font) {
	Relation_Check_Font = relation_Check_Font;
}

public static Font getKnowledge_Font() {
	return Knowledge_Font;
}

public static void setKnowledge_Font(Font knowledge_Font) {
	Knowledge_Font = knowledge_Font;
}

public static Font getKnowledge_Label_Font() {
	return Knowledge_Label_Font;
}

public static void setKnowledge_Label_Font(Font knowledge_Label_Font) {
	Knowledge_Label_Font = knowledge_Label_Font;
}

public static Font getKnowledge_Cursor_Font() {
	return Knowledge_Cursor_Font;
}

public static void setKnowledge_Cursor_Font(Font knowledge_Cursor_Font) {
	Knowledge_Cursor_Font = knowledge_Cursor_Font;
}

public static int getString_Formal_Assertion() {
	return String_Formal_Assertion;
}

public static void setString_Formal_Assertion(int string_Formal_Assertion) {
	String_Formal_Assertion = string_Formal_Assertion;
}

public static Font getStatus_English_Font() {
	return Status_English_Font;
}

public static void setStatus_English_Font(Font status_English_Font) {
	Status_English_Font = status_English_Font;
}





}
